package com.stox.charting.ui.swing.widget;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.stox.charting.ui.swing.model.BarType;
import com.stox.charting.ui.swing.view.ChartingInternalFrameView;
import com.stox.core.ui.swing.wrapper.JComboBox;

public class BarTypeComboBox extends JComboBox implements ActionListener {
	private static final long serialVersionUID = -7141083408858875258L;

	public BarTypeComboBox() {
		super(BarType.values());
		setSelectedItem(BarType.HLC);
		addActionListener(this);
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		//super.actionPerformed(e);
		ChartingInternalFrameView view = ChartingInternalFrameView.getLastSelectedView();
		if(view != null){
			view.getPriceChartView().getPriceChart().getModel().setBarType((BarType)getItemAt(getSelectedIndex()));
		}
	}
	
}
